package cn.dengta.webapp.user.form;

import java.util.List;

import cn.dengta.common.model.Messager;
import cn.dengta.common.model.Status;
import cn.dengta.common.util.Common;
import cn.dengta.common.validator.Check;
import cn.dengta.webapp.base.form.BaseForm;
import lombok.*;
import me.codeplayer.util.*;

@Getter
@Setter
public class VerifyForm extends BaseForm<Void> {

	@Check(value = "ID", i18n = false, required = false)
	public Long id;
	@Check(value = "status", i18n = false)
	public Integer status;
	public String remark;
	/** 恢复默认 */
	public Integer recover;
	@Check(value = "原因ID", required = false, i18n = false)
	public Long remarkId;
	@Setter(AccessLevel.NONE)
	public List<Long> ids;

	@Override
	public void validate() {
		Assert.isTrue(X.matchAllOrNone(X.isValid(id), !X.isValid(ids)), "ID不能为空！");
		Assert.notTrue(!Status.asResult(status) && StringUtil.isEmpty(remark), "审核意见不能为空！");
		Assert.isTrue(recover == null || !Status.asResult(status), "只有拒审才能设置恢复默认！");
		/*
		if (StringUtil.notEmpty(remark)) {
			Assert.isTrue(remarkId != null, "国际化原因ID不能为空！");
		}
		*/
	}

	public void setIds(String ids) {
		this.ids = Common.splitAsLongList(ids);
	}

}
